import request from '@/api/request'

/**
 * 获取订单列表ajax请求
 * @param {*} start 开始页
 * @param {*} limit 每页几条数据
 * @param {*} data 传递的参数 {title:'',author:''}
 * @returns
 */

export function orderList(start, limit, data) {
  return request({
    url: `/lejuAdmin/order/findOrdersByPage/${start}/${limit}`, // 相对路径
    method: 'post',
    data
  })
}
// 订单详情
export function orderDetail(orderId) {
  return request({
    url: `/lejuAdmin/order/orderDetail/${orderId}`,
    method: 'get'
  })
}
// 发货
export function sendOrder(data) {
  return request({
    url: `/lejuAdmin/order/sendDone`,
    method: 'post',
    data
  })
}
// 完成
export function finishOrder(orderId) {
  return request({
    url: `/lejuAdmin/order/finishOrder/${orderId}`,
    method: 'post'
  })
}
// 强制确认收货
export function forceFinishOrder(orderId) {
  return request({
    url: `/lejuAdmin/order/receiveProductsForce/${orderId}`,
    method: 'post'
  })
}
// 退单列表API
export function orderBackDetail(id) {
  return request({
    url: `/lejuAdmin/orderReturn/${id}`,
    method: 'get'
  })
}
// 同意退货
export function agreeReturn(id, data) {
  return request({
    url: `/lejuAdmin/orderReturn/agreeApply/${id}`,
    method: 'post',
    data
  })
}
// 拒绝退货
export function rejectReturn(id, data) {
  return request({
    url: `/lejuAdmin/orderReturn/rejectApply/${id}`,
    method: 'post',
    data
  })
}
// 确认收货
export function receiveReturn(id, data) {
  return request({
    url: `/lejuAdmin/orderReturn/receiveProduct/${id}`,
    method: 'post',
    data
  })
}
